package me.acomma.groot.infrastructure.dao;

import me.acomma.groot.domain.user.User;
import me.acomma.groot.domain.user.UserId;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface UserDao {
    int insert(User user);

    int delete(@Param("userId") UserId userId);

    int update(User user);

    User select(@Param("userId") UserId userId);

    List<User> pagedQuery(@Param("user") User user);

    User selectByUsername(String username);

    void deleteUserRoleByUserId(@Param("userId") UserId userId);

    void insertUserRole(@Param("userId") Long userId, @Param("roleIds") List<Long> roleIds);
}
